{% extends 'manager/base/base.html' %}
{% load bootstrap_pagination %}
{% block css %}
<link rel="stylesheet" href="/static/manager/plugins/editormd/css/editormd.css" />
{% endblock %}

{% block navbar %}
  <div class="navbar navbar-default" role="navigation">
    <div class="container-fluid">
      <ul class="nav navbar-nav list-inline navbar-left">
        <li class="list-inline-item">
          <button class="button-menu-mobile open-left">
            <i class="mdi mdi-menu"></i>
          </button>
        </li>
        <li class="list-inline-item">
          <h4 class="page-title">留言创建</h4>
        </li>
      </ul>
    </div>
  </div>
{% endblock %}

{% block content %}
  <div class="container-fluid">
    <div class="row">
      <div class="col-12">
        <div class="card-box">
          <form class="form-horizontal" action="{% url 'ownmessage_add' %}" method="post" enctype="multipart/form-data">
            <input type="hidden" name="editor" value="2">
            <div class="form-group">
              <h5>简介 <span class="text-danger">*</span></h5>
              <div class="controls">
                <input name="summary" id="summary" class="form-control">
              </div>
            </div>
            <div class="form-group">
              <h5>寄语内容 <span class="text-danger">*</span></h5>
              <div id="my-editormd" class="controls">
                <textarea style="display:none;" name="message"></textarea>
              </div>
            </div>
            <a href="{% url 'ownmessage_list' %}" class="btn btn-inverse">返回</a>
            <button type="submit" class="btn btn-success">提交</button>
          </form>
        </div>
      </div>
    </div>
  </div>
{% endblock %}

{% block js %}
<script src="/static/manager/plugins/editormd/editormd.min.js"></script>
<script>
  var testEditor;
  testEditor = editormd("my-editormd", {
    width: "100%",
    height: 640,
    syncScrolling: "single",
    path: "/static/manager/plugins/editormd/lib/",   // 你的path路径（原资源文件中lib包在我们项目中所放的位置）
    saveHTMLToTextarea: true,
    emoji: true,
    taskList: true,
    tocm: true,         // Using [TOCM]
    tex: true,                   // 开启科学公式TeX语言支持，默认关闭
    flowChart: true,             // 开启流程图支持，默认关闭
    sequenceDiagram: true,       // 开启时序/序列图支持，默认关闭,
    toolbarIcons : function() {  // 自定义工具栏，后面有详细介绍
      return editormd.toolbarModes['full']; // full, simple, mini
    },
    imageUpload : true,
    imageFormats : ["jpg", "jpeg", "gif", "png", "bmp", "webp"],
    imageUploadURL : '/upload/'
  });
</script>
{% endblock %}
